using System;
using System.Collections.Generic;
using NHibernate.Mapping.Attributes;
using A = NHibernate.Mapping.Attributes;

namespace SuperMarketManagement.Entity
{

    [Class(Name = "InvoiceItem")]
    public class InvoiceItem
    {
        [Id(1, Name = "AutoId"), Generator(2, Class = "native")]
        public virtual long AutoId { get; set; }
        [Property]
        public virtual double Quantity { get; set; }
        [Property]
        public virtual double Price { get; set; }

        [ManyToOne(Column = "productId")]
        public virtual Product Product { get; set; }

        [ManyToOne(Column = "InvoiceAutoId")]
        public virtual Invoice Invoice { get; set; }

        public InvoiceItem()
        {
        }

        public InvoiceItem(Product product, double quantity, double price)
        {
            Quantity = quantity;
            Price = price;
            Product = product;
        }
    }
}